LAB 2 Assignment¶

This article, it explores into a report by Stanford University researchers highlighting the challenges faced by AI ethics practitioners and the need for improved ethical practices within tech firms

Leo Messi's first touch of world cup trophy after winning the final in 2022

Name Quantity
Apple 3
Egg 12
Pear 10
Mango 7
Banana 3

1. Creating a simple graph using matplotlib¶

In [1]:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()  # Create a figure containing a single axes.
ax.plot([1, 2, 3, 4,5], [1, 4, 10, 3,-15])  # Plot some data on the axes.
Out[1]:
[<matplotlib.lines.Line2D at 0x1f90cc04390>]

2. Stacked histogram on a log scale using seaborn¶

In [2]:
import seaborn as sns
import matplotlib as mpl
import matplotlib.pyplot as plt
In [3]:
sns.set_theme(style="ticks")

diamonds = sns.load_dataset("diamonds")

f, ax = plt.subplots(figsize=(7, 5))
sns.despine(f)

sns.histplot(
    diamonds,
    x="price", hue="cut",
    multiple="stack",
    palette="light:m_r",
    edgecolor=".3",
    linewidth=.5,
    log_scale=True,
)
ax.xaxis.set_major_formatter(mpl.ticker.ScalarFormatter())
ax.set_xticks([100, 200, 400, 800, 1000, 2000, 4000, 8000])
Out[3]:
[<matplotlib.axis.XTick at 0x1f930a21750>,
 <matplotlib.axis.XTick at 0x1f92f376290>,
 <matplotlib.axis.XTick at 0x1f930e77c90>,
 <matplotlib.axis.XTick at 0x1f930e27a90>,
 <matplotlib.axis.XTick at 0x1f930dc4b90>,
 <matplotlib.axis.XTick at 0x1f930dc42d0>,
 <matplotlib.axis.XTick at 0x1f931008f50>,
 <matplotlib.axis.XTick at 0x1f930a75fd0>]

3. Line plots on Date axes using plotly¶

In [4]:
import plotly.express as px
import plotly.offline as po
po.init_notebook_mode()
In [5]:
df = px.data.stocks()
fig = px.line(df, x='date', y="GOOG")
fig.show()